package mark.tom.gear.base.interceptor

import android.content.Context
import com.alibaba.android.arouter.facade.Postcard
import com.alibaba.android.arouter.facade.annotation.Interceptor
import com.alibaba.android.arouter.facade.callback.InterceptorCallback
import com.alibaba.android.arouter.facade.template.IInterceptor
import mark.tom.gear.base.utils.LogUtil

/**
 * @Description: 自定义路由拦截器(日志记录)
 * @Author: ttmk110@163.com
 * @Package: mark.tom.gear.base.interceptor
 * @Date: 2021/1/14
 * @Copyright: 版权归 Mark 所有
 * <ModifyLog>
 * @ModifyContent:
 * @Author:
 * @Date:
 * </ModifyLog>
 */
@Interceptor(priority = 10, name = "日志打印拦截器")
class LogInterceptor : IInterceptor {

    override fun process(postcard: Postcard?, callback: InterceptorCallback?) {
        LogUtil.d("LogIInterceptor Postcard -> %s", postcard?.uri.toString())
        // 不进行拦截
        callback?.onContinue(postcard)
    }

    override fun init(context: Context?) {
        // Do Nothing
    }
}